x86/HVM: correct notion of new CPL in task switch emulation
authorJan Beulich <jbeulich@suse.com>
Tue, 6 Jun 2017 12:36:41 +0000 (14:36 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 6 Jun 2017 12:36:41 +0000 (14:36 +0200)
commit9c4f1b72571b215e80abf0490073438831dc785b
tree5c2a55403ab638d1e829702baf179e4f065fda7f
parent0762e2502f1fa955176c3f17c0cfb3916498428f
x86/HVM: correct notion of new CPL in task switch emulation

Commit aac1df3d03 ("x86/HVM: introduce hvm_get_cpl() and respective
hook") went too far in one aspect: When emulating a task switch we
really shouldn't be looking at what hvm_get_cpl() returns, as we're
switching all segment registers.

The issue manifests as a vmentry failure for 32bit VMs which use task
gates to service interrupts/exceptions, in situations where delivering
the event interrupts user code, and a privilege increase is required.

However, instead of reverting the relevant parts of that commit, have
the caller tell the segment loading function what the new CPL is. This
at once fixes ES being loaded before CS so far having had its checks
done against the old CPL.

Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Tested-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/hvm/hvm.c